var QQMapWX = require('../../libs/qqmap-wx-jssdk.js');
var qqmapsdk;
Page({
  data: {
    latitude: 0,//地图初次加载时的纬度坐标
    longitude: 0, //地图初次加载时的经度坐标
    name: "" //选择的位置名称
  },
  onLoad: function () {
    // 实例化API核心类
    qqmapsdk = new QQMapWX({
      //key: 'MNXBZ-G5TWD-GYF42-HHZJL-2W2J3-PVBX4'
      key: 'IM6BZ-HZORR-TRQW6-WUC5W-SDAWE-W4F5Q'
    });

  this.moveToLocation();
  },
  //移动选点
  moveToLocation: function () {
    var that = this;
    wx.chooseLocation({
      success: function (res) {
        console.log(res);
        if (res.name==""){
                
        }else{
          //选择地点之后返回到原来页面
          wx.navigateTo({
            url: "/pages/ticket/address/address?address=" + res.name
          });
        }
      },
      fail: function (err) {
        console.log(err)
      }
    });
  }
});